package com.zhongyi.http.service.impl;

import com.zhongyi.db.DBManager;
import com.zhongyi.entity.Company;
import com.zhongyi.entity.Contact;
import com.zhongyi.http.service.FileService;

public class FileServiceImpl implements FileService {
	
	public DBManager dbManager ;
	
	public void setDbManager(DBManager dbManager) {
		this.dbManager = dbManager;
	}

	@Override
	public boolean saveCorp(String saveSQL, Company corp) {
		int res = dbManager.insertToDB(saveSQL, new Object[]{corp.getId(),corp.getCorp_name(),corp.getArea_id(),corp.getAdress(),corp.getOrigin_site(),corp.getHome_page(),corp.getCorp_level(),corp.getCorp_type(),corp.getLinker(),corp.getKeyword(),corp.getCreate_time(),corp.getRemark()});
		if(res > 0){
			return true;
		}
		return false;
	}

	@Override
	public boolean saveContact(String saveSQL, Contact contact) {
		int res = dbManager.insertToDB(saveSQL, new Object[]{contact.getId(),contact.getCorp_id(),contact.getContact_info(),contact.getInfo_type(),contact.getRemark(),contact.getCreate_time()});
		if(res > 0){
			return true;
		}
		return false;
	}

}
